//
//  OETrancactionTableViewCell.m
//  OneEightyNine
//
//  Created by Mac on 2019/3/4.
//  Copyright © 2019 stoneobs. All rights reserved.
//

#import "OETrancactionTableViewCell.h"

@interface  OETrancactionTableViewCell()
@property(nonatomic, strong) STLabel                     *desLable;/**<  */
@property(nonatomic, strong) STLabel                     *moneyLable;/**<  */
@property(nonatomic, strong) STLabel                     *timeLable;/**<  */
@end
@implementation OETrancactionTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 75;
}
#pragma mark --subView
- (void)configSubView{
    self.desLable = [[STLabel alloc] initWithFrame:CGRectMake(10, 0, UIScreenWidth, 40)
                                                     text:@""
                                                textColor:FirstTextColor
                                                     font:15
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.desLable];
    
    
    self.timeLable = [[STLabel alloc] initWithFrame:CGRectMake(10, self.desLable.bottom, UIScreenWidth, 40)
                                              text:@""
                                         textColor:SecendTextColor
                                              font:13
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.timeLable];
    
    self.moneyLable = [[STLabel alloc] initWithFrame:CGRectMake(10, 0, UIScreenWidth, self.class.cellHeight)
                                              text:@""
                                         textColor:FirstTextColor
                                              font:15
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentRight];
    self.moneyLable.right = UIScreenWidth - 15;
    [self addSubview:self.moneyLable];
}
- (void)setModel:(OETransationModel *)model{
    _model = model;
    self.desLable.text = model.change_desc;
    NSDate * date = [NSDate dateWithTimeIntervalSinceNow:model.change_time.integerValue].st_localDate;
    self.timeLable.text = date.stmc_yyyyMMddhhmmssWithDate;
    if (model.change_type.integerValue == 0) {
        self.moneyLable.text = [NSString stringWithFormat:@"+%@",model.user_money];
        self.moneyLable.textColor = FlatRed;
    }else{
        self.moneyLable.text = [NSString stringWithFormat:@"-%@",model.user_money];
        self.moneyLable.textColor = FirstTextColor                                           ;
    }
    
}
@end
